<%--
  Created by IntelliJ IDEA.
  User: HP
  Date: 2021/10/25
  Time: 19:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>demo2</title>
</head>
<body>
<p>myName:<%=request.getAttribute("myName")%></p>
<p>myName:${requestScope.myName}</p>
<p>myName:${myName}</p>

<p>年龄：<%=session.getAttribute("myAge")%></p>
<p>年龄：${sessionScope.myAge}</p>
<p>年龄：${myAge}</p><%--page--->request--->session---->servletContext(application)--%>

<p>学校：<%=application.getAttribute("mySchool")%></p>
<p>学校：${applicationScope.mySchool}</p>
<%
    Cookie[] cookies = request.getCookies();
    String value = "";
    for (Cookie cookie : cookies) {
        if (cookie.getName().equals("myAddress")) {
            value = cookie.getValue();
        }
    }
%>
<p>地址：<%=value %></p>
<p>地址：${cookie.myAddress.value}</p>

</body>
</html>
